import QtQuick
import QtQuick.Controls

Window {
    width: 640
    height: 480
    visible: true
    title: qsTr("Tumbler样式3")
    color: "#404040"  // 设置窗口背景色

    Tumbler {
        anchors.centerIn: parent  // 居中显示
        width: 100
        height: 200
        
        Rectangle {
            anchors.fill: parent
            color: "#202020"
            radius: 5
            z: -1
        }

        model: 50
        delegate: Text {
            id: delegateText
            text: modelData
            color: "white"
            font.pixelSize: 16 + (1 - Math.abs(delegateText.Tumbler.displacement)) * 10
            opacity: 0.5 + (1 - Math.abs(delegateText.Tumbler.displacement)) * 0.5
            horizontalAlignment: Text.AlignHCenter
            verticalAlignment: Text.AlignVCenter
            width: 100  // 确保文本居中
            transform: [
                Rotation {
                    origin.x: width / 2
                    origin.y: height / 2
                    axis { x: 1; y: 0; z: 0 }
                    angle: delegateText.Tumbler.displacement * 30
                },
                Scale {
                    origin.x: width / 2
                    origin.y: height / 2
                    xScale: 1.0 - Math.abs(delegateText.Tumbler.displacement) * 0.2
                    yScale: 1.0 - Math.abs(delegateText.Tumbler.displacement) * 0.2
                }
            ]
        }
    }
}
